package com.example.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.entity.SysSms;
import com.example.handler.SysSmsHandler;
import com.example.mapper.SysSmsMapper;
import com.example.service.SysSmsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SysSmsServiceImpl extends ServiceImpl<SysSmsMapper, SysSms> implements SysSmsService {

    @Resource
    private SysSmsHandler sysSmsHandler;

    @Override
    public void sendSms(SysSms sysSms) {
        this.save(sysSms);
        sysSmsHandler.send(sysSms);
    }

    @Override
    public void sendBatchSms(List<SysSms> sysSms) {
        this.saveBatch(sysSms);
        sysSmsHandler.sendBatch(sysSms);
    }
}
